package com.xbongbong.paas.service.log.crm.operation.impl;

import com.xbongbong.paas.service.log.crm.operation.AbstractCrmOperationLogHandle;
import com.xbongbong.parent.interfaces.logger.ArchiveOperationLogHandle;
import com.xbongbong.parent.interfaces.logger.FocusOperationLogHandle;
import com.xbongbong.paas.service.log.crm.operation.OpportunityOperationLogHandle;
import com.xbongbong.parent.interfaces.logger.PushNotifyLogHandle;
import com.xbongbong.pro.log.pojo.dto.AddFocusDTO;
import com.xbongbong.pro.log.pojo.dto.DeleteFocusDTO;
import com.xbongbong.pro.log.pojo.dto.DeletePushNotifyDTO;
import com.xbongbong.saas.enums.OperateModuleTypeEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import com.xbongbong.saas.enums.business.SalesOpportunityEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 *
 * date: 2022/5/16 10:03 上午
 * @author yingjf
 */
@Slf4j
@Service("opportunityLogHandleImpl")
public class OpportunityLogHandleImpl extends AbstractCrmOperationLogHandle
        implements OpportunityOperationLogHandle , FocusOperationLogHandle , ArchiveOperationLogHandle, PushNotifyLogHandle {

    @Override
    public List<Integer> type() {
        return Arrays.asList(XbbRefTypeEnum.SALES_OPPORTUNITY.getCode());
    }

    @Override
    @Async("sysLogThreadPool")
    public void deletePushNotify(DeletePushNotifyDTO deletePushNotifyDTO) {
        deletePushNotify(deletePushNotifyDTO, SalesOpportunityEnum.NAME.getAttr());
    }

    @Override
    @Async("sysLogThreadPool")
    public void add(AddFocusDTO addFocusDTO) {
        addFocus( addFocusDTO,OperateModuleTypeEnum.OPPORTUNITY);
    }

    @Override
    @Async("sysLogThreadPool")
    public void delete(DeleteFocusDTO deleteFocusDTO) {
        deleteFocus( deleteFocusDTO,OperateModuleTypeEnum.OPPORTUNITY);
    }
}
